import axios from '@/utils/request';

export const queryProductList = async (data: Record<string, any>): Promise<any> => (await axios.post('/backend/core/apply-product/product-list', data)).data;

export const queryProduct = async (id: number): Promise<any> => (await axios.get(`/backend/core/apply-product/show-product/${id}`)).data;
export const createProduct = async (data: Record<string, any>): Promise<any> => (await axios.post('/backend/core/apply-product/create-product', data)).data;
export const updateProduct = async (data: Record<string, any>): Promise<any> => (await axios.post(`backend/core/apply-product/update-product/${data.id}`, data)).data;
export const deleteProduct = async (id: number): Promise<any> => (await axios.post(`/backend/core/apply-product/delete-product/${id}`)).data;
export const productVersionList = async (data: Record<string, any>): Promise<any> => (await axios.post('/backend/core/apply-product/product-version-list', data)).data;
export const createProductVersion = async (data: Record<string, any>): Promise<any> => (await axios.post('/backend/core/apply-product/create-product-version', data)).data;
export const updateProductVersion = async (data: Record<string, any>): Promise<any> => (await axios.post(`/backend/core/apply-product/update-product-version/${data.id}`, data)).data;
export const deleteProductVersion = async (id: number): Promise<any> => (await axios.post(`/backend/core/apply-product/delete-product-version/${id}`)).data;
export const queryProductTry = async (data: Record<string, any>): Promise<any> => (await axios.post('/backend/core/apply-product/apply-product-trial-list', data)).data;
export const updateProductTry = async (data: Record<string, any>): Promise<any> => (await axios.post(`/backend/core/apply-product/update-apply-product-trial/${data.id}`, data)).data;
export const queryProductFeedback = async (data: Record<string, any>): Promise<any> => (await axios.post('/backend/core/apply-product/product-feedback-list', data)).data;
export const updateProductFeedback = async (data: Record<string, any>): Promise<any> => (await axios.post(`/backend/core/apply-product/update-product-feedback/${data.id}`, data)).data;
export const queryProductWorker = async (data: Record<string, any>): Promise<any> => (await axios.post('/backend/core/apply-product/product-maintainer-list', data)).data;
export const deleteProductWorker = async (id: number): Promise<any> => (await axios.post(`/backend/core/apply-product/delete-product-maintainer/${id}`)).data;
export const createProductWorker = async (data: Record<string, any>): Promise<any> => (await axios.post('/backend/core/apply-product/create-product-maintainer', data)).data;
export const queryProductChannel = async (data: Record<string, any>): Promise<any> => (await axios.post('/backend/core/apply-product/product-channel-relation', data)).data;
export const createProductChannel = async (data: Record<string, any>): Promise<any> => (await axios.post('/backend/core/apply-product/link-product-channel', data)).data;
export const productFeedbackDetail = async (id: number): Promise<any> => (await axios.get(`/apply-product/show-product-feedback/${id}`)).data;

export const queryHomepageEnvironment = async (): Promise<any> => (await axios.get('/backend/core/homepage/environment')).data;
export const queryHomepageGeneratedKey = async (): Promise<any> => (await axios.get('/backend/core/homepage/generated-key')).data;

